<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">

<head>
  <title></title>
  <meta charset="utf-8">
  <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
  <link rel="stylesheet" href="css/ui-box.css">
  <link rel="stylesheet" href="css/ui-base.css">
  <link rel="stylesheet" href="css/ui-color.css">
  <link rel="stylesheet" href="css/appcan.icon.css">
  <link rel="stylesheet" href="css/appcan.control.css">
  <link rel="stylesheet" href="css/BaggageTrace.css">
  <link rel="stylesheet" href="css/base.css">
</head>

<body class="um-vp bcFFF" ontouchstart>
  <main class="">
      <img src="images/bg.png" style="display:none;" />    
    <canvas id = "watermark" width = "200px"  height = "100px" style="display:none;"></canvas>
    <canvas id = "repeat-watermark"></canvas>
    <ul id="flightList">
      <!-- <li class="listItems fs9">
        <div class="ub p8 ub-pj tx-c bor_bot_E7E7E7">
          <section class="ub ub-ver">
            <p class="mb5">上海虹桥</p>
            <div class="ub">
              <p class="mr5 c9B9B9B">起飞</p>
              <p class="c9B9B9B">08:00</p>
            </div>
          </section>
          <section class="ub ub-ver canvas_wrap">
            <p>MU292</p>
            <div class="imgStyle icons_src_BT_1002 h5"></div>
            <p class="">2017-08-29</p>
          </section>
          <section class="ub ub-ver">
            <p class="mb5">北京首都</p>
            <div class="ub">
              <p class="mr5 c9B9B9B">到达</p>
              <p class="c9B9B9B">09:00</p>
            </div>
          </section>
        </div>
      </li> -->

    </ul>

  </main>
</body>
<script src="js/appcan.js"></script>
<script src="js/appcan.control.js"></script>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/z_API.js"></script>
<script src="js/talkingdata.js"></script>
<script>
  appcan.ready(function() {
      iG.bgm();
        var http = appcan.locStorage.getVal("baggageHttp");
        var url = http+"zyh_queryFlightHaveBagCount";
        var flightListData = JSON.parse(appcan.locStorage.getVal("flightListBaggage"));
 
        var template = "";
        var departDate = "";
        var arriveDate = "";
        var depart = "";
        var arrive = "";
        //航班信息数组
        var flightList = [];
        if (flightListData.length > 0) {
 
          flightListData.forEach(function(item,index) {

            //航班信息对象
            var flightObj = {};
            if(!item.airportName){
              item.airportName = "未知";
            }
            if(!item.destinationName){
              item.destinationName = "未知";
            }

            if (item.atd) {
              arrive = "实飞";
              arriveDate = item.atd;
            } else if (item.etd) {
              arrive = "预飞";
              arriveDate = item.etd;
            } else if (item.std) {
              arrive = "计飞";
              arriveDate = item.std;
            }else{
              arrive = "暂无";
            }

            if (item.ata) {
              depart = "实到";
              departDate = item.ata;
            } else if (item.eta) {
              depart = "预到";
              departDate = item.eta;
            } else if (item.sta) {
              depart = "计到";
              departDate = item.sta;
            }else{
              depart = "暂无";
            }
            
            //时间戳转换
            item.flightDate = timestampTransitionDate(item.flightDate);

            arriveDate = timestampTransitionTimes(arriveDate);
            departDate = timestampTransitionTimes(departDate);
            flightObj.airport = item.airport;
            flightObj.destination = item.destination;
            flightObj.airportName = item.airportName;
            flightObj.arrive = arrive;
            flightObj.arriveDate = arriveDate;
            flightObj.flightNo = item.flightNo;
            flightObj.flightDate = item.flightDate;
            flightObj.destinationName = item.destinationName;
            flightObj.depart = depart;
            flightObj.departDate = departDate;
            flightObj.airportShow = item.airportShow;
            flightList.push(flightObj);

            template += '<li class="listItems fs9" data-index="'+index+'" flight-id="' + item.id + '">' +
              '<div class="ub p8 ub-pj tx-c bor_bot_E7E7E7">' +
              '<section class="ub ub-ver">' +
              '<p class="mb5">' + item.airportName + '</p>' +
              '<div class="ub lh15">' +
              '<p class="mr5 c9B9B9B">' + arrive + '</p>' +
              '<p class="c9B9B9B">' + arriveDate + '</p>' +
              '</div>' +
              '</section>' +
              '<section class="ub ub-ver canvas_wrap">' +
              '<p>' + item.flightNo + '</p>' +
              '<div class="imgStyle icons_src_BT_1002 h5"></div>' +
              '<p class="">' + item.flightDate + '</p>' +
              '</section>' +
              '<section class="ub ub-ver">' +
              '<p class="mb5">' + item.destinationName + '</p>' +
              '<div class="ub lh15">' +
              '<p class="mr5 c9B9B9B">' + depart + '</p>' +
              '<p class="c9B9B9B">' + departDate + '</p>' +
              '</div>' +
              '</section>' +
              '</div>' +
              '</li>';
          });

          $("#flightList").html(template);
          //航班信息列表
          appcan.button(".listItems", " btn-act", function() {
              
              IC.talkingDataCount("行李服务","16");
              
              var index = $(this).attr("data-index");
              var flightObj = flightList[Number(index)];
              //是否显示行李扫面模块。
              appcan.locStorage.setVal("airportShow",flightObj.airportShow);
              //航班列表数据
              appcan.locStorage.setVal("flightObj",JSON.stringify(flightObj));
              
           var remark = "航班号:" + flightObj.flightNo + ",出发站三字码:" + flightObj.airport + ",到达站三字码:" + flightObj.destination + ",航班日期:"+flightObj.flightDate + ",操作时间:" + getNowDateHourMinutes();
           operatingRecord(userName,"航班行李信息查询",remark); 
              
              //航班Id
              var id = $(this).attr("flight-id");

              var param = {
                flightId:id,
                token:token
              }
              var res = new AJAXRequestData({
                url: url,
                type:"POST",
                data: param

              }, function(res) {

                appcan.locStorage.setVal("flightHaveBagCount",res);
                appcan.window.open({
                  name: "BaggageInfosPage",
                  dataType: 0,
                  aniId: 5,
                  data: "BaggageInfosPage.html",
                });
              });

            });

            } else {
              notData("#flightList");
            }
          });
</script>

</html>
